﻿using JV.Com.Internals;
using JV.Com.Model;
using Microsoft.Practices.Prism.StoreApps;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace JV.Com.ViewModels.Wrapper
{
    public sealed class SearchResultWrapper : ViewModel
    {
        private readonly SearchResultPageViewModel m_parent;
        private readonly List<SearchResultGameWrapper> m_games;
        private readonly string m_title;

        public SearchResultWrapper(SearchResultPageViewModel parent, string title)
            : base()
        {
            m_parent = parent;
            m_title = title;
            m_games = new List<SearchResultGameWrapper>();
        }

        public List<SearchResultGameWrapper> Games { get { return m_games; } }
        public string GroupTitle { get { return m_title; } }
        public SearchResultPageViewModel Parent { get { return m_parent; } }
    }

    public sealed class SearchResultGameWrapper : ViewModel
    {
        private readonly SearchResultWrapper m_parent;
        private readonly Game m_game;

        public SearchResultGameWrapper(SearchResultWrapper parent, Game game)
        {
            m_parent = parent;
            m_game = game;
        }

        public int Id { get { return m_game.Id; } }
        public string Title { get { return m_game.Title; } }
        public string Support { get { return m_game.Support; } }

        public void OnClick()
        {
            m_parent.Parent.NavigationService.Navigate("DetailGame", m_game.Id);
        }
    }
}
